import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: 路由配置项
 *
 * hidden: true                   // 当设置 true 的时候该路由不会再侧边栏出现 如401，login等页面，或者如一些编辑页面/edit/1
 * alwaysShow: true               // 当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式--如组件页面
 *                                // 只有一个时，会将那个子路由当做根路由显示在侧边栏--如引导页面
 *                                // 若你想不管路由下面的 children 声明的个数都显示你的根路由
 *                                // 你可以设置 alwaysShow: true，这样它就会忽略之前定义的规则，一直显示根路由
 * redirect: noRedirect           // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 * name:'router-name'             // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * meta : {
    roles: ['admin','editor']    // 设置该路由进入的权限，支持多个权限叠加
    title: 'title'               // 设置该路由在侧边栏和面包屑中展示的名字
    icon: 'svg-name'             // 设置该路由的图标，对应路径src/icons/svg
    breadcrumb: false            // 如果设置为false，则不会在breadcrumb面包屑中显示
  }
 */

// 公共路由
export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: (resolve) => require(['@/views/redirect'], resolve)
      }
    ]
  },
  {
    path: '/home',
    component: (resolve) => require(['@/views/home'], resolve),
    name: 'Home',
    hidden: true
  },
  {
    path: '/primaryMenu',
    component: (resolve) => require(['@/views/primaryMenu'], resolve),
    name: 'PrimaryMenu',
    hidden: true
  },
  {
    path: '/login',
    component: (resolve) => require(['@/views/login'], resolve),
    hidden: true
  },
  {
    path: '/404',
    component: (resolve) => require(['@/views/error/404'], resolve),
    hidden: true
  },
  {
    path: '/401',
    component: (resolve) => require(['@/views/error/401'], resolve),
    hidden: true
  },
  
  {
    path: '',
    component: Layout,
    redirect: 'index',
    status: true,
    children: [
      {
        path: 'index',
        component: (resolve) => require(['@/views/index'], resolve),
        name: 'Index',
        meta: { title: '首页', icon: 'dashboard', noCache: false, affix: true }
      },
      {
    
        path: '/apply/loan',
        component: (resolve) => require(['@/views/approval/approvalDocManage/apply-loan'], resolve),
        name:"申请",
        meta: { title: '申请个人借款', icon: 'dashboard', noCache: false, affix: true },
        hidden:true
      },
      {
    
        path: '/examine/entry',
        component: (resolve) => require(['@/views/system/dung/index'], resolve),
        name:"入职",
        meta: { title: '待我审批入职', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/examine/personalLoan',
        component: (resolve) => require(['@/views/system/personalLoan/index'], resolve),
        name:"个人借款",
        meta: { title: '待我审批个人借款', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/examine/purchase',
        component: (resolve) => require(['@/views/system/purchase/index'], resolve),
        name:"采购申请",
        meta: { title: '待我审批采购申请', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/examine/quit',
        component: (resolve) => require(['@/views/system/quit/index'], resolve),
        name:"离职",
        meta: { title: '待我审批离职', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/examine/workOvertime',
        component: (resolve) => require(['@/views/system/workOvertime/index'], resolve),
        name:"加班",
        meta: { title: '待我审批加班', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/examine/reimbursements',
        component: (resolve) => require(['@/views/system/reimbursements/index'], resolve),
        name:"费用报销",
        meta: { title: '待我审批费用报销', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/application/personalLoan',
        component: (resolve) => require(['@/views/system/loan/index'], resolve),
        name:"个人借款",
        meta: { title: '我的申请个人借款', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/application/entry',
        component: (resolve) => require(['@/views/system/entry/index'], resolve),
        name:"入职",
        meta: { title: '我的申请入职', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/application/purchase',
        component: (resolve) => require(['@/views/system/mypurchase/index'], resolve),
        name:"采购申请",
        meta: { title: '我的申请采购申请', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/application/quit',
        component: (resolve) => require(['@/views/system/myquit/index'], resolve),
        name:"离职",
        meta: { title: '我的申请离职', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/application/workOvertime',
        component: (resolve) => require(['@/views/system/myworkOvertime/index'], resolve),
        name:"加班",
        meta: { title: '我的申请加班', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/application/reimbursements',
        component: (resolve) => require(['@/views/system/myreimbursements/index'], resolve),
        name:"费用报销",
        meta: { title: '我的申请费用报销', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/myApproval/personalLoan',
        component: (resolve) => require(['@/views/system/applyloan/index'], resolve),
        name:"个人借款",
        meta: { title: '我的审批个人借款', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/myApproval/entry',
        component: (resolve) => require(['@/views/system/applyentry/index'], resolve),
        name:"入职",
        meta: { title: '我的审批入职', icon: 'dashboard', noCache: false, affix: false },
        path: '/apply/purchase',
        component: (resolve) => require(['@/views/approval/approvalDocManage/purchase'], resolve),
        name:"申请",
        meta: { title: '采购申请', icon: 'dashboard', noCache: false, affix: true },
        hidden:true
      },
      {
    
        path: '/myApproval/purchase',
        component: (resolve) => require(['@/views/system/applypurchase/index'], resolve),
        name:"采购申请",
        meta: { title: '我的审批采购申请', icon: 'dashboard', noCache: false, affix: false },
        // path: '/apply/entry',
        // component: (resolve) => require(['@/views/approval/approvalDocManage/entry'], resolve),
        // name:"申请",
        // meta: { title: '入职', icon: 'dashboard', noCache: false, affix: true },
        // hidden:true
      },
      {path: '/apply/entry',
        component: (resolve) => require(['@/views/approval/approvalDocManage/entry'], resolve),
        name:"申请",
        meta: { title: '入职', icon: 'dashboard', noCache: false, affix: true },
        hidden:true},
      {
    
        path: '/myApproval/quit',
        component: (resolve) => require(['@/views/system/applyquit/index'], resolve),
        name:"离职",
        meta: { title: '我的审批离职', icon: 'dashboard', noCache: false, affix: false },
      },
      {path: '/apply/quit',
        component: (resolve) => require(['@/views/approval/approvalDocManage/quit'], resolve),
        name:"离职",
        meta: { title: '离职', icon: 'dashboard', noCache: false, affix: true },
        hidden:true},
      {
    
        path: '/myApproval/workOvertime',
        component: (resolve) => require(['@/views/system/applyworkOvertime/index'], resolve),
        name:"加班",
        meta: { title: '我的审批加班', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/myApproval/reimbursements',
        component: (resolve) => require(['@/views/system/applyreimbursements/index'], resolve),
        name:"费用报销",
        meta: { title: '我的申请费用报销', icon: 'dashboard', noCache: false, affix: false },
      },
      {path: '/apply/workOvertime',
        component: (resolve) => require(['@/views/approval/approvalDocManage/workOvertime'], resolve),
        name:"加班",
        meta: { title: '加班', icon: 'dashboard', noCache: false, affix: true },
        hidden:true},
      {
        path: '/apply/reimbursement',
        component: (resolve) => require(['@/views/approval/approvalDocManage/reimbursement'], resolve),
        name:"费用报销",
        meta: { title: '费用报销', icon: 'dashboard', noCache: false, affix: true },
        hidden:true
      },
      {
    
        path: '/comprehensive/personalLoan',
        component: (resolve) => require(['@/views/system/tloan/index'], resolve),
        name:"个人借款",
        meta: { title: '我的审批个人借款', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/comprehensive/entry',
        component: (resolve) => require(['@/views/system/tentry/index'], resolve),
        name:"入职",
        meta: { title: '我的审批入职', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/comprehensive/purchase',
        component: (resolve) => require(['@/views/system/tpurchase/index'], resolve),
        name:"采购申请",
        meta: { title: '我的审批采购申请', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/comprehensive/quit',
        component: (resolve) => require(['@/views/system/tquit/index'], resolve),
        name:"离职",
        meta: { title: '我的审批离职', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/comprehensive/workOvertime',
        component: (resolve) => require(['@/views/system/tworkOvertime/index'], resolve),
        name:"加班",
        meta: { title: '我的审批加班', icon: 'dashboard', noCache: false, affix: false },
        hidden:true
      },
      {
    
        path: '/comprehensive/reimbursements',
        component: (resolve) => require(['@/views/system/treimbursements/index'], resolve),
        name:"费用报销",
        meta: { title: '我的申请费用报销', icon: 'dashboard', noCache: false, affix: false },
        path: '/examine/entry',
        component: (resolve) => require(['@/views/system/dung/index'], resolve),
        name:"入职",
        meta: { title: '待我审批入职', icon: 'dashboard', noCache: false, affix: true },
        hidden:true
      },
    ]
  },
  // {
  //   path: '/approval',
  //   component: Layout,
  //   hidden: false,
  //   meta: { title: '审批', icon: 'user' },
  //   children: [
  //     {
  //       path: '/approvalDocManage/approvalDoc',
  //       component: (resolve) => require(['@/views/workflow/approvalDocManage/approvalDoc'], resolve),
  //       name: 'ApprovalDoc',
  //       meta: { title: '查看呈批件', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/approvalDocManage/printApprovalDoc',
  //       component: (resolve) => require(['@/views/workflow/approvalDocManage/printApprovalDoc'], resolve),
  //       name: 'PrintApprovalDoc',
  //       meta: { title: '呈批件打印单', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/postProcessSheetManage/addEditPost',
  //       component: (resolve) => require(['@/views/workflow/postProcessSheetManage/addEditPost'], resolve),
  //       name: 'AddEditPost',
  //       meta: { title: '新建发文处理单', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/postProcessSheetManage/approvalPost',
  //       component: (resolve) => require(['@/views/workflow/postProcessSheetManage/approvalPost'], resolve),
  //       name: 'ApprovalPost',
  //       meta: { title: '查看发文处理单', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/postProcessSheetManage/printPost',
  //       component: (resolve) => require(['@/views/workflow/postProcessSheetManage/printPost'], resolve),
  //       name: 'PrintPost',
  //       meta: { title: '发文打印单', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/receiptProcessSheetManage/addEditReceipt',
  //       component: (resolve) => require(['@/views/workflow/receiptProcessSheetManage/addEditReceipt'], resolve),
  //       name: 'AddEditReceipt',
  //       meta: { title: '新建收文处理单', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/receiptProcessSheetManage/approvalReceipt',
  //       component: (resolve) => require(['@/views/workflow/receiptProcessSheetManage/approvalReceipt'], resolve),
  //       name: 'ApprovalReceipt',
  //       meta: { title: '查看收文处理单', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/receiptProcessSheetManage/printReceipt',
  //       component: (resolve) => require(['@/views/workflow/receiptProcessSheetManage/printReceipt'], resolve),
  //       name: 'PrintReceipt',
  //       meta: { title: '收文打印单', icon: 'dashboard' }
  //     }
  //   ]
  // },
  {
    path: '',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [
      {
        path: 'workActivity',
        component: (resolve) => require(['@/views/workActivity'], resolve),
        name: 'WorkActivity',
        meta: { title: '工作流设计', icon: 'user' }
      }
    ]
  },
  {
    path: '/user',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [
      {
        path: 'profile',
        component: (resolve) => require(['@/views/system/user/profile/index'], resolve),
        name: 'Profile',
        meta: { title: '个人中心', icon: 'user' }
      }
    ]
  },
  {
    path: '/dict',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'type/data/:dictId(\\d+)',
        component: (resolve) => require(['@/views/system/dict/data'], resolve),
        name: 'Data',
        meta: { title: '字典数据', icon: '' }
      }
    ]
  },
  {
    path: '/job',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'log',
        component: (resolve) => require(['@/views/monitor/job/log'], resolve),
        name: 'JobLog',
        meta: { title: '调度日志' }
      }
    ]
  },
  {
    path: '/gen',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'edit/:tableId(\\d+)',
        component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
        name: 'GenEdit',
        meta: { title: '修改生成配置' }
      }
    ]
  },
  {
    path: '/workflow',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/approvalDocManage/addEditDoc',
        component: (resolve) => require(['@/views/workflow/approvalDocManage/addEditDoc'], resolve),
        name: 'AddEditDoc',
        meta: { title: '新建呈批件', icon: '' }
      },
      {
        path: '/approvalDocManage/approvalDoc',
        component: (resolve) => require(['@/views/workflow/approvalDocManage/approvalDoc'], resolve),
        name: 'ApprovalDoc',
        meta: { title: '查看呈批件', icon: '' }
      },
      {
        path: '/approvalDocManage/printApprovalDoc',
        component: (resolve) => require(['@/views/workflow/approvalDocManage/printApprovalDoc'], resolve),
        name: 'PrintApprovalDoc',
        meta: { title: '呈批件打印单', icon: '' }
      },
      {
        path: '/postProcessSheetManage/addEditPost',
        component: (resolve) => require(['@/views/workflow/postProcessSheetManage/addEditPost'], resolve),
        name: 'AddEditPost',
        meta: { title: '新建发文处理单', icon: '' }
      },
      {
        path: '/postProcessSheetManage/approvalPost',
        component: (resolve) => require(['@/views/workflow/postProcessSheetManage/approvalPost'], resolve),
        name: 'ApprovalPost',
        meta: { title: '查看发文处理单', icon: '' }
      },
      {
        path: '/postProcessSheetManage/printPost',
        component: (resolve) => require(['@/views/workflow/postProcessSheetManage/printPost'], resolve),
        name: 'PrintPost',
        meta: { title: '发文打印单', icon: '' }
      },
      {
        path: '/receiptProcessSheetManage/addEditReceipt',
        component: (resolve) => require(['@/views/workflow/receiptProcessSheetManage/addEditReceipt'], resolve),
        name: 'AddEditReceipt',
        meta: { title: '新建收文处理单', icon: '' }
      },
      {
        path: '/receiptProcessSheetManage/approvalReceipt',
        component: (resolve) => require(['@/views/workflow/receiptProcessSheetManage/approvalReceipt'], resolve),
        name: 'ApprovalReceipt',
        meta: { title: '查看收文处理单', icon: '' }
      },
      {
        path: '/receiptProcessSheetManage/printReceipt',
        component: (resolve) => require(['@/views/workflow/receiptProcessSheetManage/printReceipt'], resolve),
        name: 'PrintReceipt',
        meta: { title: '收文打印单', icon: '' }
      }
    ]
  },
  {
    path: '/statute',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'type/data/:policyId(\\d+)',
        component: (resolve) => require(['@/views/system/statute/data'], resolve),
        name: 'StatuteDetails',
        meta: { title: '查看政策法规', icon: '' }
      },
      {
        path: 'type/add/',
        component: () => import("@/views/system/statute/addEdit"),
        name: 'statuteAdd',
        meta: { title: '添加政策法规', icon: '' }
      },
      {
        path: 'type/edit/',
        component: () => import("@/views/system/statute/addEdit"),
        name: 'statuteEdit',
        meta: { title: '修改政策法规', icon: '' }
      }
    ]
  },
  {
    path: '/information',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'type/data/:informationId(\\d+)',
        component: (resolve) => require(['@/views/system/information/data'], resolve),
        name: 'InformationDetails',
        meta: { title: '查看新闻资讯', icon: '' }
      },
      {
        path: 'type/add/',
        component: () => import("@/views/system/information/addEdit"),
        name: 'informationAdd',
        meta: { title: '添加新闻资讯', icon: '' }
      },
      {
        path: 'type/edit/',
        component: () => import("@/views/system/information/addEdit"),
        name: 'informationEdit',
        meta: { title: '修改新闻资讯', icon: '' }
      }
    ]
  },
  {
    path: '/announcement',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'type/data/:announcementId(\\d+)',
        component: (resolve) => require(['@/views/system/announcement/data'], resolve),
        name: 'AnnouncementDetails',
        meta: { title: '查看通知公告', icon: '' }
      },
      {
        path: 'type/add/',
        component: () => import("@/views/system/announcement/addEdit"),
        name: 'announcementAdd',
        meta: { title: '添加通知公告', icon: '' }
      },
      {
        path: 'type/edit/',
        component: () => import("@/views/system/announcement/addEdit"),
        name: 'announcementEdit',
        meta: { title: '修改通知公告', icon: '' }
      }
    ]
  },
  {
    path: '/circula',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'type/data/:circulaId(\\d+)',
        component: (resolve) => require(['@/views/system/circula/data'], resolve),
        name: 'CirculaDetails',
        meta: { title: '查看信息通告', icon: '' }
      },
      {
        path: 'type/add/',
        component: () => import("@/views/system/circula/addEdit"),
        name: 'circulaAdd',
        meta: { title: '添加信息通告', icon: '' }
      },
      {
        path: 'type/edit/',
        component: () => import("@/views/system/circula/addEdit"),
        name: 'circulaEdit',
        meta: { title: '修改信息通告', icon: '' }
      }
    ]
  },
  {
    path: '/content',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'type/data/:contentId(\\d+)',
        component: (resolve) => require(['@/views/system/content/data'], resolve),
        name: 'ContentDetails',
        meta: { title: '查看栏目内容', icon: '' }
      },
      {
        path: 'type/add/',
        component: () => import("@/views/system/content/addEdit"),
        name: 'contentAdd',
        meta: { title: '添加栏目内容', icon: '' }
      },
      {
        path: 'type/edit/',
        component: () => import("@/views/system/content/addEdit"),
        name: 'contentEdit',
        meta: { title: '修改栏目内容', icon: '' }
      }
    ]
  },
  {
    path: '/template',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'type/data/',
        component: () => import("@/views/system/template/data"),
        name: 'TemplateDetails',
        meta: { title: '查看标准模板', icon: '' }
      },
      {
        path: 'type/add/',
        component: () => import("@/views/system/template/addEdit"),
        name: 'templateAdd',
        meta: { title: '添加标准模板', icon: '' }
      },
      {
        path: 'type/edit/',
        component: () => import("@/views/system/template/addEdit"),
        name: 'templateEdit',
        meta: { title: '修改标准模板', icon: '' }
      }
    ]
  }
]

export default new Router({
  mode: 'history', // 去掉url中的#
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})
